//
//  SearchContentCellView.m
//  dhfsAPP
//
//  Created by Devil on 2017/8/7.
//  Copyright © 2017年 Devil. All rights reserved.
//

#import "SearchContentCellView.h"

@implementation SearchContentCellView

#pragma mark - 构造函数
-(instancetype)initWithFrame:(CGRect)frame ImgUrl:(NSString *)imgUrl Title:(NSString *)title Time:(NSString *)time PlayNum:(NSString *)playNum{
    self = [super initWithFrame:frame];
    
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        UIImageView *headerImgV = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH(22), HEIGHT(28), WIDTH(240), HEIGHT(145))];
        
        [headerImgV sd_setImageWithURL:[NSURL URLWithString:imgUrl]];
        
        [self addSubview:headerImgV];
        
        UILabel *cellTitle = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH(293), HEIGHT(28), 0, 0)];
        
        cellTitle.text = title;
        cellTitle.textColor = RGB(51, 51, 51);
        cellTitle.font = [UIFont fontWithName:@"PingFangSC-Regular" size:HEIGHT(28)];
        
        [cellTitle sizeToFit];
//        if ((int)((int)cellTitle.frame.size.width / (int)WIDTH(415)) > 0)
//        {
//            cellTitle.numberOfLines = cellTitle.frame.size.width / WIDTH(415);
//            
//            cellTitle.frame = CGRectMake(WIDTH(293), HEIGHT(28), WIDTH(415), HEIGHT(33) * (int)(cellTitle.frame.size.width / WIDTH(415)));
//        }
        
        [self addSubview:cellTitle];
        
        UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH(293), HEIGHT(148), 0, 0)];
        
        timeLabel.text = [NSString stringWithFormat:@"时长：%@",time];
        timeLabel.textColor = RGB(122, 122, 122);
        timeLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:HEIGHT(26)];
        
        [timeLabel sizeToFit];
        
        [self addSubview:timeLabel];
        
        UILabel *playNumLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH(597), HEIGHT(148), 0, 0)];
        
        playNumLabel.text = [NSString stringWithFormat:@"播放：%@",playNum];
        playNumLabel.textColor = RGB(122, 122, 122);
        playNumLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:HEIGHT(26)];
        
        [playNumLabel sizeToFit];
        
        [self addSubview:playNumLabel];
    
    }
    
    return self;
}

@end
